package com.kevin;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Day {
	
	private String getPreMonthId(String _yyyyMM) throws ParseException{
		SimpleDateFormat sdf=new SimpleDateFormat("yyyyMM"); 
		Calendar c = Calendar.getInstance();
		c.setTime(sdf.parse(_yyyyMM));
		c.add(Calendar.MONTH, -1);
		return sdf.format(c.getTime());
	}
	
	public static void main(String[] args) throws ParseException {
		System.out.println(new Day().getPreMonthId("201401"));
		System.out.println(new Day().getPreMonthId("201402"));
	}

}
